package task_process

import (
	"context"
	"github.com/gin-gonic/gin"
	"github.com/hibiken/asynq"
	"sdapiproject/middleware"
)

func AddTxt2ImgTask(prompt, task_id string) error {
	return AddTaskToQueue(SD_TASK_TO_IMAGE, gin.H{"prompt": prompt, "task_id": task_id}, 0)
}

func ProcessFlyArchArticleItem(c context.Context, t *asynq.Task) error {
	prompt, _ := t.Payload.GetString("prompt")
	taskId, _ := t.Payload.GetString("task_id")

	middleware.Txt2imgTask(prompt, taskId, nil)

	return nil
}
